package com.saudidentalapp;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;

import com.astuetz.viewpager.extensions.ScrollingTabsView;
import com.astuetz.viewpager.extensions.TabsAdapter;
import com.astuetz.viewpager.extensions.example.adapter.ScrollingTabsAdapter;

/**
 * This class is used to hold the main layout for the application.
 * This will hold the activities of all the tabs in it, using which at any point
 * of time while running the application one activity will be visible 
 * @author Anand
 *
 */
public class MainActivity extends Activity implements OnPageChangeListener
{
	private ScrollingTabsView mScrollingTabs;
	private TabsAdapter mScrollingTabsAdapter;
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_scrolling_tabs);
		initViewPager(12, 0xFF000000, 0xFFFFFFFF);
		mScrollingTabs = (ScrollingTabsView) findViewById(R.id.scrolling_tabs);
		mScrollingTabsAdapter = new ScrollingTabsAdapter(this);
		mScrollingTabs.setAdapter(mScrollingTabsAdapter);
		mScrollingTabs.setViewPager(mPager);
	}
	
	
	private ViewPager mPager;
	private PagerAdapter mPagerAdapter;
	
	private void initViewPager(int pageCount, int backgroundColor, int textColor) 
	{
		mPager = (ViewPager) findViewById(R.id.pager);
		//mPagerAdapter = new ExamplePagerAdapter(this, pageCount, backgroundColor, textColor);
		mPagerAdapter = new MyPageLayoutAdapter(this);
		mPager.setOnPageChangeListener(this);
		
		mPager.setAdapter(mPagerAdapter);
		mPager.setCurrentItem(1);
		mPager.setPageMargin(0);
		
		
	}

	@Override
	public void onPageScrollStateChanged(int arg0) 
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onPageScrolled(int arg0, float arg1, int arg2) 
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onPageSelected(int arg0) 
	{
		// TODO Auto-generated method stub
		
	}
}